{
 "cells": [
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 将所有的元音字母（a, e, i, o, u）全部转换为大写；将所有非元音字母全部转换为小写。\n",
    "    输入格式\n",
    "    输入的第一行为一个正整数 T（1≤T≤50），表示需要处理的歌词的数量。接下来的 T 行，每行包含一首歌的歌词。歌词只包含大写字母和小写字母。歌词的长度不会超过 50 个字符。\n",
    "    输出格式\n",
    "    对于每一首歌，输出处理后的歌词。每首歌的处理结果占一行。\n"
   ],
   "id": "838ce75b22cb1a61"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-12T14:16:30.467501Z",
     "start_time": "2025-03-12T14:16:12.779980Z"
    }
   },
   "cell_type": "code",
   "source": [
    "T=int(input())\n",
    "for _ in range(T):\n",
    "    w=input()\n",
    "    for i in w:\n",
    "        if i in 'a,e,i,o,u': \n",
    "            w=w.replace(i,i.upper())\n",
    "        else:\n",
    "            w=w.replace(i,i.lower())\n",
    "    print(w)"
   ],
   "id": "a8820e330306e292",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Abcgf\n",
      "shdjk\n",
      "xkUhg\n"
     ]
    }
   ],
   "execution_count": 5
  },
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-03-06T09:13:05.273656Z",
     "start_time": "2025-03-06T09:12:37.648944Z"
    }
   },
   "source": [
    "T=int(input())\n",
    "for i in range(T):\n",
    "    wds=input()\n",
    "    for wd in wds:\n",
    "        if wd in wds:\n",
    "            if wd in 'a,e,i,o,u':\n",
    "                wds=wds.replace(wd,wd.upper())\n",
    "            else:\n",
    "                wds=wds.replace(wd,wd.lower())\n",
    "    print(wds)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sAdg\n",
      "dAsdqw\n",
      "sfAcAsd\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 找出哪一类书籍被贴上特别标签的比例最低，即从该类书籍中随机选择一本时，拿到带有特别标签书籍的概率最小。\n",
    "    输入格式：输入的第一行包含一个整数N  t,p表示书籍的库存总数和被贴特别标签的数量。\n",
    "    输出格式：输出一个整数，表示被贴特别标签比例最低的书籍类别的索引（索引从1开始）。如果有多个答案，则输出索引值最小的那个。"
   ],
   "id": "ae4866bb9c265c6e"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-06T09:54:47.225780Z",
     "start_time": "2025-03-06T09:54:32.697312Z"
    }
   },
   "cell_type": "code",
   "source": [
    "N=int(input())\n",
    "l=[]\n",
    "for i in range(N):\n",
    "    t,p=map(int,input().split())\n",
    "    l.append(p/t)\n",
    "m=l.index(min(l))  #列表.index(元素)  查找指定元素下标\n",
    "print(m+1)"
   ],
   "id": "1bf3cfc691836f89",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n"
     ]
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 二进制转换",
   "id": "6bfdffef5dec8a4a"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": [
    "a=bin(20241111)\n",
    "print(a[2:]) #字符串没有pop()操作！！！可以用切片操作"
   ],
   "id": "5368b56979111f38"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 最长子序列\n",
    "\n",
    "\n",
    "    我们称一个字符串S包含字符串T是指T是S的一个子序列，即可以从字符串S中抽出若干个字符，它们按原来的顺序组合成一个新的字符串与T完全一样。给定两个字符串S和T，请问T中从第一个字符开始最长连续多少个字符被S包含？"
   ],
   "id": "60bda206e63872c"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-06T10:43:56.221621Z",
     "start_time": "2025-03-06T10:43:26.443148Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#注意是从第一个字符开始！！！\n",
    "S=input()\n",
    "T=input()\n",
    "count=0\n",
    "for i in S:\n",
    "    if i==T[count]:   #连续！！！\n",
    "        count+=1\n",
    "print(count)"
   ],
   "id": "78ab0bce426e05e6",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 矩形切割\n",
    "    小明有一些矩形的材料，他要从这些矩形材料中切割出一些正方形。当他面对一块矩形材料时，他总是切出一块最大的正方形，剩下一块矩形，然后再切割剩下的矩形材料，直到全部切为正方形为止。现在小明有一块矩形的材料，两边长分别是2019和324。请问小明最终会切出多少个正方形？"
   ],
   "id": "e582de1efa59b12b"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-06T10:56:41.396917Z",
     "start_time": "2025-03-06T10:56:41.387939Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# a,b=2019,324\n",
    "a,b=5,3\n",
    "count=0\n",
    "while a!=b:\n",
    "    if a>b:\n",
    "        a-=b\n",
    "        count+=1\n",
    "    elif a<b:\n",
    "        a,b=b,a\n",
    "print(count+1)"
   ],
   "id": "1172e3096f93931d",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "execution_count": 7
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 空间\n",
    "    256MB 的空间可以存储多少个32位二进制整数？"
   ],
   "id": "8314296a193f2165"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-06T11:14:25.940555Z",
     "start_time": "2025-03-06T11:14:25.908853Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#1GB=1024MB  1MB=1024KB 1KB=1024字节  \n",
    "#32位二进制  32/8=4字节\n",
    "print(int(256*1024*1024/(32/4)))"
   ],
   "id": "8173297250b4c3ec",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "33554432\n"
     ]
    }
   ],
   "execution_count": 3
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 时间显示\n",
    "    在服务器上，朋友已经获取了当前的时间，用一个整数表示，值为从1970年1月1日00:00:00到当前时刻经过的毫秒数。现在，小蓝要在客户端显示出这个时间。小蓝不用显示出年月日，只需要显示出时分秒即可，毫秒也不用显示，直接舍去即可。给定一个用整数表示的时间，请将这个时间对应的时分秒输出。"
   ],
   "id": "336c660f82d1228a"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-06T12:04:58.339114Z",
     "start_time": "2025-03-06T12:04:52.300019Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#这个经过了一点点的提示，但几乎全部都是自己做的，在巩固一下\n",
    "n=int(input())//1000 #毫秒转化为秒\n",
    "t=60*60*24  #一天的秒数\n",
    "n=n%t #剩余的秒数  除余啊\n",
    "hour=n//3600\n",
    "n1=n-hour*3600\n",
    "minute=n1//60\n",
    "miao=n1%60\n",
    "print(\"%02d:%02d:%02d\"%(hour,minute,miao))"
   ],
   "id": "7cecde206bd05dc5",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "13:00:00\n"
     ]
    }
   ],
   "execution_count": 6
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 跑步\n",
    "    小蓝每周六、周日都晨跑，每月的1、11、21、31日也晨跑。其它时间不晨跑.已知2022年1月1日是周六，请问小蓝整个2022年晨跑多少天？"
   ],
   "id": "df62e8908e828dcb"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-06T12:43:45.191413Z",
     "start_time": "2025-03-06T12:43:45.167884Z"
    }
   },
   "cell_type": "code",
   "source": [
    "month=[31,28,31,30,31,30,31,31,30,31,30,31]\n",
    "li=[1,11,21,31]\n",
    "count=0\n",
    "sum=0\n",
    "for i in month:\n",
    "    for j in range(1,i+1):   #表示一年的365天\n",
    "        sum+=1\n",
    "        if j in li:\n",
    "            count+=1\n",
    "        else:\n",
    "            if (sum%7==1) or (sum%7==2):\n",
    "                count+=1\n",
    "print(count)\n",
    "        \n",
    "            "
   ],
   "id": "2eba707c289a843d",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "138\n"
     ]
    }
   ],
   "execution_count": 7
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": [
    "# # 请在此输入您的代码\n",
    "# #1,3,5,7,8,10,12   31天   1、11、21、31\n",
    "# #2 28天                   1、11、21\n",
    "# #4，6，9，11     30天      1、11、21\n",
    "# #365天\n",
    "# a=7*4+5*3\n",
    "# #周末   跑了&没跑\n",
    "# b=(365//7)*2\n",
    "# #找重\n"
   ],
   "id": "f7120b84cb4beff7"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": [
    "import os\n",
    "import sys\n",
    "\n",
    "# 请在此输入您的代码\n",
    "count=0\n",
    "N,D=map(int,input().split())\n",
    "list=input().split()\n",
    "for j in list:\n",
    "    if j >=80 or j<=9:\n",
    "        count+=1\n",
    "print((N-count))"
   ],
   "id": "2168f917285aa8a7"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 灵石疫苗的分配\n",
    "    在远古的大陆上，灵石疫苗终于诞生，为了抵御邪恶的黑暗生物，蓝桥王国的国王决定尽快开始对公民进行灵石疫苗接种。总共有N名公民，他们的能力等级分别为a1,a2...an;在这片大陆上，只有一处神秘的圣殿可以进行灵石疫苗的注入，每天最多能为D名公民注入疫苗。任何能力等级大于或等于80或者小于等于9的公民都被认为是处于危险之中。每一天，你不能同时给处于危险的公民和不处于危险的公民注射疫苗。你需要计算出最少需要多少天才能给所有公民注入灵石疫苗。\n",
    "    输入格式:第一行包含两个空格分隔的整数N和D第二行包含N个空格分隔的整数a1,a2,...,an  输出格式：打印一行包含一个整数--所需的最少天数"
   ],
   "id": "ffb56cd37dbd2b0e"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-07T10:37:22.841448Z",
     "start_time": "2025-03-07T10:37:10.617280Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import os\n",
    "import sys\n",
    "# 请在此输入您的代码\n",
    "N,D=map(int,input().split())\n",
    "a=list(map(int,input().split()))\n",
    "num1=0   #危险之中的公民\n",
    "num2=0   #不处于危险之中的公民\n",
    "for i in a:\n",
    "    if int(i)>=80 or int(i)<=9:\n",
    "        num1+=1\n",
    "    else:\n",
    "        num2+=1\n",
    "if num1/D==0:\n",
    "    day1=num1//D \n",
    "else:\n",
    "    day1=(num1//D)+1\n",
    "if num2/D==0:\n",
    "    day2=num2//D\n",
    "else:\n",
    "    day2=(num2//D)+1\n",
    "day=day1+day2\n",
    "print(day)"
   ],
   "id": "d7c9101301c163cc",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "execution_count": 9
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "# 小桥的蓝桥四季园艺挑战\n",
    "    小桥在蓝桥镇开设了一个四季园艺中心，每个季节都会种植不同的花草。这一季，他挑选了四种花草，分别代表了春夏秋冬四季。每种花草都有一个困难指数 a1,a2,a3,a4小桥想要把这些花草组成不同的园艺套装出售，每个套装至少包含两种不同困难指数的花草，一种花草最多只能出现在一个套装中。你能帮助小桥找出他最多能组成多少个园艺套装吗？\n",
    "    输入格式\n",
    "    输入的第一行包含一个整数T表示有T组测试数据。接下来的T行，每行包含四个空格分隔的整数a1,a2,a3,a4表示四种花草的困难指数。\n",
    "    输出格式\n",
    "    对于每组测试数据，输出一行，包含一个整数，表示最多能组成的园艺套装数量"
   ],
   "id": "f1bc03151b14f9c1"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-07T11:23:00.780476Z",
     "start_time": "2025-03-07T11:22:37.144611Z"
    }
   },
   "cell_type": "code",
   "source": [
    "T=int(input())\n",
    "for i in range(T):\n",
    "    l=list(map(int,input().split()))\n",
    "    l.sort()\n",
    "    if l[0]==l[3]:  #说明全相等\n",
    "        print(0)\n",
    "    elif l[0]==l[2] or l[1]==l[3]:\n",
    "        print(1)\n",
    "    else :\n",
    "        print(2)"
   ],
   "id": "785e40793d6a482b",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "1\n",
      "0\n"
     ]
    }
   ],
   "execution_count": 10
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "# 联赛场次\n",
    "    通常在足球联赛里，n支球队要分主客场打循环赛，最后根据积分排名。输入球队数，输出联赛要打多少场比赛。"
   ],
   "id": "a75eb84bed33e9ba"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "#分双循环和单循环  单循环总场次 (n*(n-1))/2  双循环 n*(n-1)",
   "id": "5d122ec9c7698b28"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "#### 立方体边长和圆球直径\n",
    "    已知立方体和圆球的体积均为V，如下图所示，求正方体的边长a和圆球的直径d。输入数据占一行，为1个整数V，范围是[10, 100000]。输出占一行，为正方体的边长a和圆球的直径d，用空格隔开，保留小数点后3位小数。"
   ],
   "id": "abce994204664849"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-07T12:48:16.709896Z",
     "start_time": "2025-03-07T12:48:13.483426Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import math\n",
    "\n",
    "V=int(input())\n",
    "a=V**(1/3)\n",
    "\n",
    "d=(3*V/(4*math.pi))**(1/3)*2\n",
    "\n",
    "print(f\"{a:.3f} {d:.3f}\")"
   ],
   "id": "a16237ec14ac6138",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.154 2.673\n"
     ]
    }
   ],
   "execution_count": 12
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "### 小桥的冒险\n",
    "    小桥是一位热爱探险的少年，他总是不断的挑战各种各样的未知。这次，一个神秘的高塔吸引了他。高塔有X层，每一层都充满了未知的危险和奇遇。小桥每次可以选择攀爬Y层或者仅仅攀爬一层，但是由于高塔的特殊魔力，每一次攀爬无论攀爬多少层，都会消耗掉一次机会。现在，小桥需要你的帮助来计划他的攀爬策略，以使得他能够以最少的次数到达第X层\n",
    "    输入格式\n",
    "    首先输入一个整数T，表示有T组数据。接下来有T行，每行包含两个整数X和Y，表示需要攀爬的塔层数和每次可以攀爬的最大层数。数据范围：1≤T≤500，1≤X,Y≤100。\n",
    "    输出格式\n",
    "    输出T行，每行一个整数，表示小桥需要的最少的攀爬次数。"
   ],
   "id": "2891457137016de9"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-11T08:29:29.306973Z",
     "start_time": "2025-03-11T08:29:14.551543Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#暴力解决  其实是简单的，不过我没好好读题\n",
    "t=int(input())\n",
    "for _ in range(t):\n",
    "    n=0\n",
    "    x,y=map(int,input().split())\n",
    "    while x>0:\n",
    "        if x>=y:\n",
    "            n+=1\n",
    "            x-=y\n",
    "        else:\n",
    "            n+=1\n",
    "            x-=1\n",
    "    print(n)"
   ],
   "id": "4443a84b5efe7608",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "4\n",
      "3\n",
      "2\n"
     ]
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "### 一年中的第几天\n",
    "    输入一个日期，输出该日期是当年的第几天。\n",
    "    输入描述\n",
    "    输入文件中有多个测试数据，每个测试数据占一行，为3个整数y、m、d。输入文件最后一行为3个0，代表输入结束。\n",
    "    输出描述\n",
    "    对每个测试数据，输出占一行，为一个数值，代表该日期是当年的第几天。"
   ],
   "id": "71124e8c7847aef4"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-13T00:51:09.087096Z",
     "start_time": "2025-03-13T00:51:00.835650Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#用到日期间隔啦！！！\n",
    "from datetime import date, timedelta, datetime\n",
    "\n",
    "flag=True\n",
    "while flag:\n",
    "    y,m,d=map(int,input().split())\n",
    "    if y==0 and m==0 and d==0:\n",
    "        break\n",
    "    date1=date(y,1,1)\n",
    "    date2=date(y,m,d)\n",
    "    delta=date2-date1\n",
    "    print(delta.days+1)  #.days!!!"
   ],
   "id": "c1709118f6d360bb",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "61\n"
     ]
    }
   ],
   "execution_count": 8
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-13T04:02:19.874182Z",
     "start_time": "2025-03-13T04:02:02.912218Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import os\n",
    "import sys\n",
    "\n",
    "# 请在此输入您的代码\n",
    "T=int(input())\n",
    "for _ in range(T):\n",
    "    X,Y=map(int,input().split())\n",
    "    if X<Y: #X\n",
    "        print('BRIDGE')\n",
    "    elif Y<X:\n",
    "        print('YI')\n",
    "    elif Y==X:\n",
    "        print('ANY')"
   ],
   "id": "4a6d10c1bf4e5a6",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "YI\n",
      "BRIDGE\n",
      "BRIDGE\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-13T10:33:11.903967Z",
     "start_time": "2025-03-13T10:33:11.890580Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import math\n",
    "\n",
    "primes=[] #空列表，用于存储找到的素数。\n",
    "is_prime=[True]*(n+1)#布尔列表，长度为 n+1，初始值为 True。这个列表用于标记每个数是否为素数。\n",
    "is_prime[1]=is_prime[0]=False# 0 和 1 不是素数。\n",
    "\n",
    "for i in range(2,int(math.sqrt(n)+1)):\n",
    "    if is_prime[i]:\n",
    "        for j in range(i*i,n+1,i):  #把i的倍数标记为素数\n",
    "            is_prime[j]=False\n",
    "for i in range(2,n+1):\n",
    "    if is_prime[i]:primes.append(i)\n"
   ],
   "id": "2efb635a18f82ed2",
   "outputs": [],
   "execution_count": 4
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "### 斐波拉契求和\n",
    "    给定一个斐波拉契序列（该斐波拉契序列从2开始），前几项分别是2,3,5,8,13...，每一项分别用fib[1],fib[2],...,fib[n]表示。你需要计算出fib[1]/fib[2]+fib[2]/fib[3]+...+ fib[n-1]/fib[n]结果保留5位小数。\n",
    "    输入格式\n",
    "    输入一行，包含1个正整数n。\n",
    "    输出格式\n",
    "    输出一行，包含一个小数，表示结果。"
   ],
   "id": "26930adea612d40a"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-14T08:46:28.285843Z",
     "start_time": "2025-03-14T08:46:26.117573Z"
    }
   },
   "cell_type": "code",
   "source": [
    "n=int(input())\n",
    "a=1\n",
    "b=2\n",
    "c=0\n",
    "sum=0\n",
    "for i in range(n):\n",
    "    a,b=b,a+b\n",
    "    c=a/b\n",
    "    sum+=c\n",
    "print(round(sum,5))\n",
    "print(f\"{sum:.5f}\")\n",
    "print(format(sum,\".5f\"))  #保留小数的操作！！！"
   ],
   "id": "f870004c80d96838",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.50705\n",
      "2.50705\n",
      "2.50705\n"
     ]
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-14T11:00:36.696001Z",
     "start_time": "2025-03-14T11:00:31.445063Z"
    }
   },
   "cell_type": "code",
   "source": [
    "nums=[0]*3\n",
    "print(nums,n)"
   ],
   "id": "d62121ff2aae9409",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0, 0, 0] 9\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-14T11:09:51.083148Z",
     "start_time": "2025-03-14T11:09:48.027710Z"
    }
   },
   "cell_type": "code",
   "source": [
    "n=int(input())\n",
    "print(n)"
   ],
   "id": "b6fb7fbc0bad8014",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6\n"
     ]
    }
   ],
   "execution_count": 3
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-15T10:15:57.346431Z",
     "start_time": "2025-03-15T10:15:57.339416Z"
    }
   },
   "cell_type": "code",
   "source": [
    "list1=[1,2,3]\n",
    "lst = [ [K for K in list1] for _ in range(3) ]\n",
    "print(*lst)"
   ],
   "id": "bdfbc55c6d64268f",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3] [1, 2, 3] [1, 2, 3]\n"
     ]
    }
   ],
   "execution_count": 20
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "### 岁月流转\n",
    "    在远古的时代，有一段充满了历史的岁月。从公元1901年1月1日开始，持续到2000年12月31日，这段岁月见证了历史的变迁和人类的努力。据记载，公元1900年1月1日是周一。而在这段时间里，有多少个月的第一天是周日呢？请你帮助我们计算出这个数目，并告诉我们结果是多少。"
   ],
   "id": "c0ad635ab73e4c03"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-16T01:37:06.326935Z",
     "start_time": "2025-03-16T01:37:06.306363Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import datetime\n",
    "start=datetime.datetime(1901,1,1)\n",
    "end=datetime.datetime(2000,12,31)\n",
    "t=datetime.timedelta(days=1)#一天的时间差对象\n",
    "count=0\n",
    "\n",
    "while start<=end:\n",
    "    if start.weekday()==6 and start.day==1:\n",
    "        count+=1\n",
    "    start+=t\n",
    "print(count)"
   ],
   "id": "59cdc0b8f744f614",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "171\n"
     ]
    }
   ],
   "execution_count": 24
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-16T01:51:17.285337Z",
     "start_time": "2025-03-16T01:51:17.278363Z"
    }
   },
   "cell_type": "code",
   "source": [
    "list=[12,13,1]\n",
    "count=0\n",
    "for i in list:\n",
    "    if str(i) in '1,11,12,13':\n",
    "        count+=1\n",
    "print(count)"
   ],
   "id": "bee324cbe4a49460",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "execution_count": 33
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "### 跑步计划\n",
    "    小蓝计划在某天的日期中出现1时跑5千米，否则只跑1千米。注意日期中出现1不仅指年月日也指星期。请问按照小蓝的计划，2023年小蓝总共会跑步锻炼多少千米?例如，5月1日、1月13日、11月5日、4月3日(星期一)小蓝会跑5千米，而5月23日小蓝会跑1千米(示例日期均为2023年)"
   ],
   "id": "5d38fc8f024f58d9"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-03-16T03:08:53.903680Z",
     "start_time": "2025-03-16T03:08:53.895632Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import datetime\n",
    "start=datetime.datetime(2023,1,1)\n",
    "end=datetime.datetime(2024,1,1)\n",
    "t=datetime.timedelta(days=1)\n",
    "total=0\n",
    "while start<end:\n",
    "    if '1' in start.isoformat() or start.weekday()==0:#这里注意1下，1 in 这个返回ISO格式的字符串！\n",
    "        total+=5\n",
    "    else:\n",
    "        total+=1\n",
    "    start+=t\n",
    "print(total)"
   ],
   "id": "ec26ae0a5297d7ea",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1333\n"
     ]
    }
   ],
   "execution_count": 36
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "9593d63cdd2aba08"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
